﻿//*** Guidance generated code ***//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Castle.DynamicProxy;

using ProjectBase.Core;

namespace Survey.Tools.IoC
{
    public static class AopFilterManager
    {
        #region Init
        public static void Init()
        {
            Interceptors.Add(() => new Filters.FilterRestrictionManager());
            //Interceptors.Add(() => new FacadeExceptionFilter());
            //Interceptors.Add(() => new FacadeDebugExceptionFilter());
            //Interceptors.Add(() => new DaoExceptionFilter());
            //Interceptors.Add(() => new TracingFilter());
        }
        #endregion Init

        public static IEnumerable<IInterceptor> GetFilters()
        {
            var result = Interceptors
                .Select(filter => filter.Invoke());
            return result.ToArray();
        }

        #region properties
        static readonly ProxyGenerationOptions _aopOptions = new ProxyGenerationOptions { Selector = new AopSelector() };
        public static ProxyGenerationOptions AopOptions { get { return _aopOptions; } }
        public static readonly IList<Func<IInterceptor>> Interceptors = new List<Func<IInterceptor>>();
        #endregion properties
    }
}
